<!DOCTYPE html>
<html>
<head>
    <include file="Include:meta"/>
    <title>项目合同发票列表-目的地运营集团数据管理平台</title>
    <include file="Include:style"/>
    <style>
        .background {
            background: #f5f5f5;
        }
    </style>
</head>
<body>
<include file="Include:header"/>
<include file="Include:left"/>
<div id="main">
    <div class="crumbs">
        <div class="crumbs-text">项目合同发票列表</div>
        <div class="right">
            <a href="__APP__/ContractBack/invoice_excel/project_id/{$project_id}/contract_id/{$contract_id}/proposer/{$proposer}"
               class="btn left mr5">导出Excel</a>
            <a href="__APP__/ContractBack/add_invoice_head" class="btn left mr5">添加发票</a>
        </div>
    </div>
    <div id="content">
        <div class="table-scrollx">
            <table class="table table-bordered">
                <tr class="table-header fixed-table-header">
                    <td width="418">
                        <select name="project_id" class="form-control w400">
                            <option value=""
                            <if condition="$project_id eq null"> selected</if>
                            >项目编号-项目名称</option>
                            <foreach name="crm_project_array" item="vo">
                                <option value="{$vo['project_id']}"
                                <if condition="$project_id eq $vo['project_id']"> selected</if>
                                >{$vo['name']}</option>
                            </foreach>
                        </select>
                    </td>
                    <td>发票号码</td>
                    <td>发票抬头</td>
                    <td>关联收款阶段</td>
                    <td>开票日期</td>
                    <td>开票金额</td>
                    <td width="100">
                        <select name="contract_id" class="form-control w100">
                            <option value=""
                            <if condition="$contract_id eq null"> selected</if>
                            >合同编号</option>
                            <foreach name="contract_id_array" item="vo">
                                <option value="{$vo['contract_id']}"
                                <if condition="$contract_id eq $vo['contract_id']"> selected</if>
                                >{$vo['number']}</option>
                            </foreach>
                        </select></td>
                    <td width="90">
                        <select name="proposer" class="form-control w90">
                            <option value=""
                            <if condition="$proposer eq null"> selected</if>
                            >申请人</option>
                            <foreach name="proposer_array" item="vo">
                                <option value="{$vo['proposer']}"
                                <if condition="$proposer eq $vo['proposer']"> selected</if>
                                >{:get_userName($vo['proposer'])}</option>
                            </foreach>
                        </select></td>
                    <td>添加人（日期）</td>
                    <td>操作</td>
                    </if>
                </tr>
                <if condition="$result eq NULL">
                    <tr>
                        <td class="text-center" colspan="13">暂无相关内容</td>
                    </tr>
                </if>
                <foreach name="result" item="v">
                    <foreach name="v" item="vo" key="key">
                        <tr>
                            <if condition="$key eq 0">
                                <td rowspan="{$v|count}" style="vertical-align: middle;">
                                    <a class="xm_btn" href="javascript:;">{$vo['project_num']}-{$vo['name']}</a>
                                </td>
                            </if>
                            <td>{$vo['no']|default=""}</td>
                            <td>{$vo['title']|default=""}</td>
                            <td>{$vo['stage']}</td>
                            <td>{$vo.make_date}</td>
                            <td>{:float_money($vo['make_money'])}</td>
                            <td title="{$vo['file_name']}">{$vo['contract_number']}</td>
                            <td>{:get_userName($vo['proposer'])}</td>
                            <td>{:get_userName($vo['add_uid'])}({$vo['add_date']})</td>
                            <td class="nowrap">
                                <if condition="$vo['edit'] eq 1">
                                    <a href="__APP__/ContractBack/edit_invoice/invoice_id/{$vo['invoice_id']}"
                                       class="btn left mr5">编辑</a>
                                    <a href="javascript:;" class="delete" invoice_id="{$vo['invoice_id']}"><p
                                            class="btn left mr5">作废</p></a>
                                    <else/>
                                    <a href="javascript:;" style="background-color: grey" data-toggle="tooltip"
                                       data-placement="left" mid="320" data-original-title="已有收款不可编辑"
                                       class="btn left mr5">编辑</a>
                                    <a href="javascript:;" style="background-color: grey" data-toggle="tooltip"
                                       data-placement="left" mid="320" data-original-title="已有收款不可作废"
                                       class="btn left mr5">作废</a>
                                </if>
                            </td>
                        </tr>
                    </foreach>
                </foreach>
            </table>
        </div>
        <div class="pages">{$page}</div>
    </div>
</div>
<!--项目弹框-->
<div class="modal fade" id="xm-modal">
    <div class="modal-dialog w800">
        <div class="modal-content">
            <div class="modal-header">
                <h4>项目款项详情</h4>
                <i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
            </div>
            <div class="modal-body">

            </div>
        </div>
    </div>
</div>
<!--开票弹框-->
<div class="modal fade" id="kp-modal">
    <div class="modal-dialog w800">
        <div class="modal-content">
            <div class="modal-header">
                <h4>项目开票详情</h4>
                <i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
            </div>
            <div class="modal-body">

            </div>
        </div>
    </div>
</div>
<!--收款弹框-->
<div class="modal fade" id="sk-modal">
    <div class="modal-dialog w800">
        <div class="modal-content">
            <div class="modal-header">
                <h4>项目收款详情</h4>
                <i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
            </div>
            <div class="modal-body">

            </div>
        </div>
    </div>
</div>
<include file="Include:javascript"/>
<script>
    $(function () {
        $(document).on("change", "[name='project_id']", function () {
            var val = $(this).val();
            window.location.href = "__APP__/ContractBack/invoice/project_id/" + val;
        });
        $(document).on("change", "[name='contract_id']", function () {
            var val = $(this).val();
            window.location.href = "__APP__/ContractBack/invoice/contract_id/" + val;
        });
        $(document).on("change", "[name='proposer']", function () {
            var val = $(this).val();
            window.location.href = "__APP__/ContractBack/invoice/proposer/" + val;
        });
        //删除
        $(".delete").ajaxModal({
            "title_text": "确认提示框",
            "body_text": "您确定要作废吗？",
            "url": "__APP__/ContractBack/del_invoice/invoice_id/",
            "data": {"invoice_id": "invoice_id"}
        });
    })
</script>
</body>
</html>